const Mock = require('mockjs')

const Random = Mock.Random

let Result = {
    code: 200,
    msg: '操作成功',
    data: null
}

// 模拟验证码
// Mock.mock('/captcha','get' , () =>{
//     Result.data = {
//         token: Random.string(32),
//         captchaImg: Random.dataImage('100x40','p7n5w')
//     }

//     return Result
// })

// Mock.mock('/login','post' , () =>{

    //无法在header中传入数据jwt
    /*Result.code = 400
    Result.msg = "验证码错误"*/

    // return Result
// })

Mock.mock('/sys/userInfo','get' , () =>{

    Result.data = {
        id: "1",
        username: "test",
        avatar: "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
    }

    return Result
})

// Mock.mock('/logout','post' , () =>{

//     return Result
// })

Mock.mock('/sys/menu/nav','get' , () =>{
    let nav = [
        {
            name: 'SysMange',
            title: '系统管理',
            icon: 'el-icon-s-operation',
            component: '',
            path: '',
            children: [
                {
                    name: 'SysUser',
                    title: '用户管理',
                    icon: 'el-icon-s-custom',
                    path: '/sys/users',
                    component: 'sys/User',
                    children: []
                },
                {
                    name: 'SysRole',
                    title: '权限管理',
                    icon: 'el-icon-s-promotion',
                    path: '/sys/roles',
                    component: 'sys/Role',
                    children: []
                },
                {
                    name: 'SysUser',
                    title: '学生信息管理',
                    icon: 'el-icon-s-cooperation',
                    path: '/sys/student',
                    component: 'sys/Role',
                    children: []
                }
            ]
        },

    ]

    let authoritys = []
    Result.data = {
        nav: nav,
        authoritys: authoritys
    }
    return Result
})